/**
* @author Ucar Sahin
*
* 03.06.2011
* IProtocolService.java
* 
*/

package at.fhv.easyDietWeb.client.protocolService;

import java.util.Date;

import at.fhv.easyDietWeb.shared.util.ProtocolData;
import at.fhv.easyDietWeb.shared.util.wrappers.FoodListWrapper;
import at.fhv.easyDietWeb.shared.util.wrappers.MealTypesWrapper;
import at.fhv.easyDietWeb.shared.util.wrappers.UnitsWrapper;

import com.google.gwt.user.client.rpc.RemoteService;
import com.google.gwt.user.client.rpc.RemoteServiceRelativePath;

/**
 * Remote Service Interface for the protocol related methods.
 * @author Spiegel Philipp
 *
 */

@RemoteServiceRelativePath("ProtocolService")
public interface IProtocolService extends RemoteService
{
	/**
	 * returns the names of all known meal types
	 * @return name of the meal types
	 */
	MealTypesWrapper getMealTypes();
	
	/**
	 * checks, if the dates are not in conflict with the time span of another nutritional journal
	 * @param from start date
	 * @param until end date
	 * @return true, if the time span is unique in the therapy
	 */
	Boolean validateDates(Date from, Date until);
	
	/**
	 * calculates the number of days in the time span
	 * @param from start date
	 * @param until end date
	 * @return number of days between
	 */
	int getTimeSpan(Date from, Date until);
	
	/**
	 * gets a list of all foods, which have the pattern + any wildcards in the name
	 * @param name patter for the food name
	 * @return name of all found foods
	 */
	FoodListWrapper getFoodList(String name);
	
	/**
	 * gets all known units from the server
	 * @return names of all units
	 */
	UnitsWrapper loadUnits();
	
	/**
	 * saves a protocol on the database
	 * @param protocol the protocol to be saved
	 * @return
	 */
	Boolean saveProtocol(ProtocolData protocol);
}
